# -*- coding: utf-8 -*-
# !/usr/bin/env python
__author__ = 'wenke1'

#写一个函数，判断指定文件里是否含有指定字符串，有返回1，没有返回0

def isIncludeStr(filepath, targetStr='error'):
    fp = open(filepath)
    for line in fp:
        if targetStr in line:
            fp.close()
            return 1
        else:
            fp.close()
            return 0

print isIncludeStr('data1')
print isIncludeStr('data1', 'KEY')

